package com.authority.tree;

import java.util.List;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;

/** 
 * 节点类 
 */  
public class Node {  
    /** 
     * 节点编号 
     */  
    private String id;  
  
    /** 
     * 节点内容 
     */  
    private String text;  
  
    /** 
     * 父节点编号 
     */  
    private String parentId;  
    
    /**
     * 是否叶子节点
     */
    private Boolean leaf = false;
    
    /**
     * 是否选中
     */
    private Boolean checked = false;
    
    /**
     * 是否展开
     */
    private Boolean expanded = false;
    
    /**
     * 节点类型
     */
    private String type;
    
    /**
     * 链接地址
     */
    private String url;
    
    /**
     * 顺序号
     */
    private Integer order;
  
    /** 
     * 孩子节点列表 
     */  
    private List<Node> children = Lists.newArrayList();  
  
    // 添加孩子节点  
    public void addChild(Node node) {  
        children.add(node);  
    }  
  
    public Node(){
    	
    }
    
    public Node(String id,String text,String parentId){
    	this.id = id;
    	this.text = text;
    	this.parentId = parentId;
    }


	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}


	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Boolean getLeaf() {
		return leaf;
	}

	public void setLeaf(Boolean leaf) {
		this.leaf = leaf;
	}

	public Boolean getChecked() {
		return checked;
	}

	public void setChecked(Boolean checked) {
		this.checked = checked;
	}

	public Boolean getExpanded() {
		return expanded;
	}

	public void setExpanded(Boolean expanded) {
		this.expanded = expanded;
	}

	public List<Node> getChildren() {
		return children;
	}

	public void setChildren(List<Node> children) {
		this.children = children;
	}

	public Integer getOrder() {
		return order;
	}

	public void setOrder(Integer order) {
		this.order = order;
	} 
	
	@Override
	public String toString() {
		return JSON.toJSONString(this);
	}
}  
